addresses for virtual network interfaces. This must be a unique
value across the entire cluster.""")
+gopts.var('autostart', val='no|yes',
+ fn=set_bool, default=0,
+ use="Should the start VM automatically when Xend starts.")
+
+gopts.var('autostop', val='no|yes',
+ fn=set_bool, default=0,
+ use="Should stop VM automatically when Xend stops.")
+
+gopts.var('on_xend_stop', val='shtudown|suspend',
+ fn=set_value, default="shutdown",
+ use="""Behaviour when Xend stops and autostop is on:
+ - shutdown: Domain is shutdown;
+ - suspend: Domain is suspended;
+ """)
+
def err(msg):
"""Print an error to stderr and exit.
"""
config.append([n, v])
map(add_conf, ['name', 'memory', 'maxmem', 'shadow_memory',
- 'restart', 'on_poweroff', 'on_reboot', 'on_crash',
- 'vcpus', 'features'])
+ 'restart', 'on_poweroff',
+ 'on_reboot', 'on_crash', 'vcpus', 'features',
+ 'autostart', 'autostop', 'on_xend_stop'])
if vals.uuid is not None:
config.append(['uuid', vals.uuid])
'unpause' : ('<Domain>', 'Unpause a paused domain.'),
'uptime' : ('[-s] <Domain>', 'Print uptime for a domain.'),
+ # Life cycle xm commands
+ 'new' : ('<ConfigFile> [options] [vars]',
+ 'Adds a domain to Xend domain management'),
+ 'delete' : ('<DomainName>',
+ 'Remove a domain from Xend domain management.'),
+ 'start' : ('<DomainName>', 'Start a Xend managed domain'),
+ 'resume' : ('<DomainName>', 'Resume a Xend managed domain'),
+ 'suspend' : ('<DomainName>', 'Suspend a Xend maanged domain'),
+
# less used commands
'dmesg' : ('[-c|--clear]',
common_commands = [
"console",
"create",
+ "new",
+ "delete",
"destroy",
"dump-core",
"help",
"pause",
"reboot",
"restore",
+ "resume",
"save",
"shutdown",
+ "start",
+ "suspend",
"top",
"unpause",
"uptime",
domain_commands = [
"console",
"create",
+ "new",
+ "delete",
"destroy",
"domid",
"domname",
"reboot",
"rename",
"restore",
+ "resume",
"save",
"shutdown",
+ "start",
+ "suspend",
"sysrq",
"top",
"unpause",
print format % locals()
+def xm_start(args):
+ arg_check(args, "start", 1)
+ dom = args[0]
+ server.xend.domain.start(dom)
+
+def xm_delete(args):
+ arg_check(args, "delete", 1)
+ dom = args[0]
+ server.xend.domain.delete(dom)
+
+def xm_suspend(args):
+ arg_check(args, "suspend", 1)
+ dom = args[0]
+ server.xend.domain.suspend(dom)
+
+def xm_resume(args):
+ arg_check(args, "resume", 1)
+ dom = args[0]
+ server.xend.domain.resume(dom)
+
def xm_reboot(args):
arg_check(args, "reboot", 1, 3)
from xen.xm import shutdown
# xenstat commands
"top": xm_top,
# domain commands
+ "delete": xm_delete,
"destroy": xm_destroy,
"domid": xm_domid,
"domname": xm_domname,
"restore": xm_restore,
"save": xm_save,
"shutdown": xm_shutdown,
+ "start": xm_start,
"sysrq": xm_sysrq,
"uptime": xm_uptime,
+ "suspend": xm_suspend,
"list": xm_list,
# memory commands
"mem-max": xm_mem_max,
## The commands supported by a separate argument parser in xend.xm.
IMPORTED_COMMANDS = [
'create',
+ 'new',
'migrate',
'labels',
- 'addlabel',
'cfgbootpolicy',
'makepolicy',
'loadpolicy',
- 'dumppolicy',
+ 'dumppolicy',
+ 'addlabel',
'rmlabel',
'getlabel',
'dry-run',